package com.wans.product.service.imp;

import com.wans.product.bean.Product;
import com.wans.product.service.ProductService;
import org.springframework.stereotype.Service;

import java.math.BigDecimal;

@Service
public class ProductImp implements ProductService {
    @Override
    public Product getProduct(Long id) {
        Product product = new Product();
        product.setId(id);
        product.setPrice(new BigDecimal("101.23"));
        product.setProductName("华为手机 - " + id);
        product.setNum(5 * id);

        // 休眠 模拟服务器奔溃
        try {
            Thread.sleep(100);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }

        return product;
    }
}
